package work.mediway.mdm.core.enums;

import java.util.HashMap;
import java.util.Map;

import lombok.Getter;
import lombok.Setter;

/**
 * 操作状态
 *
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2020/12/29
 */
public enum StatusOperaEnum {

    /**
     * 执行
     */
    STATUS_EXE("EXE", "执行"),
    /**
     * 回退
     */
    STATUS_BACK("BACK", "回退"),
    /**
     * 未通过
     */
    NO_PASS("NO_PASS", "未通过"),
    /**
     * 未执行
     */
    STATUS_UN_EXE("UN_EXE", "未执行"),
    /**
     * 已执行
     */
    STATUS_EXE_ED("EXE_ED", "已执行"),
    /**
     * 终止执行
     */
    STATUS_STOP("STOP", "终止执行"),
    /**
     * 拆分
     */
    S("S", "拆分"),
    /**
     * 合并
     */
    M("M", "合并")


    // ======================================================================= //
    ;

    public static Map<String, String> map = new HashMap<>();

    public static Map<String, StatusOperaEnum> enumMap = new HashMap<>();

    static {
        StatusOperaEnum[] values = StatusOperaEnum.values();
        if (values.length > 0) {
            for (StatusOperaEnum categoryEnum : values) {
                map.put(categoryEnum.getStatusCode(), categoryEnum.getStatusDesc());
                enumMap.put(categoryEnum.getStatusCode(), categoryEnum);
            }
        }
    }

    public static StatusOperaEnum get(String code) {
        return enumMap.get(code);
    }

    StatusOperaEnum(String statusCode, String statusDesc) {
        this.statusCode = statusCode;
        this.statusDesc = statusDesc;
    }

    /**
     * Code
     */
    @Setter
    @Getter
    private String statusCode;

    /**
     * Desc
     */
    @Setter
    @Getter
    private String statusDesc;

}
